#include <stdio.h>
#include <unistd.h>
int main()
{
	pid_t id = fork();
	while (1)
	{
		char* str[] = {0};
		if (id == 0)
			str[0] = "child";
		else //id == child's pid
			str[0] = "parent";
		printf("I am %s, pid:%d, ppid:%d\n", str[0], getpid(), getppid());
		sleep(1);//睡眠一秒
	}

	return 0;
}
